Font3D 3-D Character Description Generator ----------------------------------- User's Guide Copyright (c) 1994, Todd A. Prater. ============================================================================== A Note from the Author ---------------------- There are many features I would like to add to the next release of Font3D. They include: o An MS-DOS Executable. o The ability to use Adobe PostScript Type 1 font descriptions o The ability to create entire strings of text at once o Special Effects such as beveling and rounding of edges o The ability to read TrueType font files with only Macintosh character mappings o More output formats o Graphical interfaces for OS/2 and Windows users Some of these are more difficult than others, but all will eventually find their way into the program. Since the Adobe Type 1 specification is, at least for me, fairly expensive, and since I have spent quite alot of time on this project, I have decided to ask for a small donation from those of you who find this program useful. I am not going to make a big issue of this, but please do take the time to read the file 'Register.TXT'. There are several advantages to registering, not the least of which is automatic upgrades to future versions. I had originally intended to only distribute an OS/2 executable file, along with documentation. Many people have since convinced me that this policy would needlessly exclude a large number of POV users. Although I have spent many thousands of hours programming in PC-type environments, my knowledge of UNIX leaves much to be desired. Hopefully, my code is reasonably portable, but this is definitely the area in which I would most like to hear your comments and/or suggestions. Finally, please take a look at the file 'ReadMe.TXT'. Any last-minute changes to the documentation or program will be in there, as well as known bugs at the time of release. Thank you for trying Font3D! Introduction ------------ Font3D is a utility for the creation of a three-dimensional character descriptions in a variety of formats including: o POV-Ray triangles o POV-Ray smooth_triangles o RAW triangles Any typeface can be used for which you have a TrueType font file description (*.TTF), and there are a number of other options available for fine-tuning the program's output. This document describes how to install and use the Font3D utility, as well as what to do if you have any questions, comments, or suggestions. Files in this Distribution -------------------------- The following files are included in the distribution of Font3D: ReadMe.TXT ......... Last minute changes (Please Read!) Register.TXT ....... Registration information (Please Read!) Font3D.TXT ......... Font3D User's Manual Font3D.EXE ......... OS/2 Executable F3D-SRC.ZIP ........ Font3D Source Code Installation ------------ For OS/2 users, simply copy the file Font3D.EXE to a directory in your path. Font3D doesn't require any external configuration or initialization files, so an executable is all you will need to get started. Users on other platforms (ie. LINUX, UNIX, etc...) will need to build your own executable. Instructions for doing so (if you need them) are given in the section 'Compiling the Source Code' later in this document. That's all there is to it! Getting Started --------------- Three parameters are required to be present on the command line every time you run Font3D. You must specify an input file (the font to use), an output file (to be used by the raytracer), and the character code of the glyph to generate. Here's an example: let's say we would like to generate an 'A' in Times New Roman. The very simplest way to do this would be C:\POV\UTILITY>font3d /itimes.ttf /otms065.inc /c65 This command generates a POV-formatted include file named 'tms065.inc', the skeleton of which looks like #declare ALPHA_65_XMin = 0.00 #declare ALPHA_65_YMin = 0.00 #declare ALPHA_65_ZMin = 0.00 #declare ALPHA_65_XMax = 0.583 #declare ALPHA_65_YMax = 0.656 #declare ALPHA_65_ZMax = 0.1 #declare ALPHA_65_Width = 0.583 #declare ALPHA_65_Height = 0.656 #declare ALPHA_65_Depth = 0.1 #declare ALPHA_65 = union { // Lots of little triangles go here... } Most of the character will usually be inside a unit square, but parts of some letters (especially ones with descenders like 'q' or 'g', and italics) may not. Also, you can usually count on the baseline of the font being at Y=0. By default the depth of the generated output is 0.1 units, but this may be altered with the '/d' command line switch. Once your output file is generated (ie. 'tms065.inc'), you can include it in a POV scene description, and then use the #declared object any way you like. For example: ... #include "tms065.inc" ... object { ALPHA_65 pigment { White } finish { Dull } translate <0,0,4> } object { ALPHA_65 pigment { Red } finish { Shiny } translate <-ALPHA_65_Width/2,-ALPHA_65_Height/2,-ALPHA_65_Depth/2> scale <10,10,10> } If you're using more than one typeface, you will probably need to use the '/n' command line switch to give each generated object a unique name. Instead of generating an object #declared as 'ALPHA_xxx' the specified string after the '/n' will be used: C:\POV\UTILITY>font3d /itimes.ttf /otms065.inc /c65 /nTimes_65 generates output like #declare Times_65_XMin = 0.00 #declare Times_65_YMin = 0.00 ... #declare Times_65 = { ... } Probably the best way to learn how to use Font3D is to play around with it. As a side note, some options are not compatible with each other. For example: if the '/fr' option is used (generating RAW output), both '/n' and '/t' switches will be ignored, because they apply only to POV formatted output. Command Line Options -------------------- /cnnn Character code of the object to create. Currently, this must be an integer between zero and 255. Most TrueType fonts use ASCII codes for letters, numbers, and punctuation marks, but you may have to experiment to find codes for special-purpose glyphs. (REQUIRED) /dnn.nn Depth of the object. The default value is 0.1 units, which creates a character whose front face is at Z=0.1, and whose back face is at z=0. /fr Generate RAW triangle output. Options not available with this format are '/n' and '/t'. /fs Generate a POV formatted output file that uses smooth triangles for the sides of a character. This allows you to use a lower curve resolution (for less triangles, and faster rendering times), to produce better looking objects. /ifilename Filename of the TrueType Font to use as a typeface. It must be a 'Windows' TrueType font; 'Macintosh' fonts are not yet supported. (REQUIRED) /nstring Specifies a string from which all #declared objects in the output file will be base. If this option is not used, the default string is 'ALPHA_nnn', where 'nnn' is the character code of the glyph being generated. /ofilename Name of the output file to generate. (REQUIRED) /rnnn Curve resolution (a positive integer). The outlines that describe a character are stored in the font file as a series of both lines and curves. Font3D must approximate the curves as a series of short line segments, and this option allows for control over how many of these segments are used for each curve. The default value is 5. Be careful, objects can become unwieldy if too large a curve resolution is used. /tnnn Angle threshold in degrees (an integer between 0 and 360). This value sets a limiting angle below which adjacent facets along the edge of a character will be smoothed together. Usually, the default value of 20 degrees seems to work well. Compiling the Source Code ------------------------- The source code should compile without modification under the following OS/Compiler combinations: o MS-DOS 5.0/Borland C++ 3.1 o IBM OS/2 2.1/IBM CSet++ 2.1 o Sun OS 4.1/GNU C++ 5.2.4 As I have said before, I have very little experience with workstation-type environments. Hopefully, I have documented the code well enough for you to make any changes necessary for compilation on your machine, and I encourage you to let me know if any modifications are needed. The archive 'F3D-SRC.ZIP' contains the following files: Source Files: build.cc ..........Routines that build the face and edges of an object. font3d.cc .........Contains the command line parser, and a routine to create and output the object. geometry.cc .......Implements the triangle and polygon classes. truetype.cc .......Implements the class 'TTFont'. Header Files: Array.H ...........Implements a 'large' array template. Allows MS-DOS machines to allocate arrays larger than 64K. Build.H ...........Header for 'build.cc'. Config.H ..........Data types and enumerations. Font3D.H ..........Header for 'font3d.cc'. Geometry.H ........Header for 'geometry.cc'. Contains definitions for the 'TRIANGLE' and 'POLYGON' classes. List.H ............A simple Linked-List class template. TrueType.H ........Header for 'truetype.cc. Contains definitions for the 'TTFont' class. Vector.H ..........Defines a vector class. Coming Soon... -------------- At the very top of my list of things to do is making Font3D capable of reading Macintosh Truetype Fonts. This is really a very simple matter, I just haven't had time to do it yet. Also, those of you that have looked at the source code may have noticed an attempt at beveling edges. I have made alot of progress in this area, but my algorithm doesn't always work, so I decided to disable it for now. As far as Postscript Font capability is concerned, I will probably wait until I see some interest in this program before I buy the specification. If anyone knows where I can get a cheap copy, let me in on it! How to Contact Me ----------------- E-Mail: squid@ksu.ksu.edu USPS: Todd A. Prater 1016 Vattier St. Apt. A Manhattan, KS. 66502 Phone: (913) 776-3597 (No Collect Calls)